{extend name="./app/admin/view/main.html" /}
{block name="title"}推送设置 - {__block__}{/block}
{block name="style"}
<style>
</style>
{/block}

{block name="main"}
<header class="mipcms-container-header">
    <div class="float-left header-group">
        <h4 class="title">系统</h4> <h5 class="sub-title">推送设置</h5>
    </div>
    <button type="button" class="pull-right ivu-btn ivu-btn-primary ivu-btn-circle" @click='onSubmitSetting'>
        <span>立即保存</span>
    </button>
</header>

<main class="mipcms-container-body" style="height: calc(100% - 50px)">

    <section class="mip-box">
        <section class="mip-box-heading">
            <h3>MIP推送</h3>
        </section>
        <section class="mip-box-body">
            <i-form label-position="top">
                <div class="row">
                    <div class="col-md-8">
                        <Form-item label="MIP引入提交接口【mipApiAddress】">
                            <i-input v-model="setting.mipApiAddress"
                                     placeholder="例：http://data.zz.baidu.com/urls?site=mip.test.pingbuwang.com&token=WpBlhXLC8JCl9EUt&type=mip"></i-input>

                        </Form-item>
                    </div>
                    <div class="col-md-4">
                        <Form-item label="MIP自动推送【mipPostStatus】">
                            <i-switch v-model="setting.mipPostStatus">
                                <span slot="open">开</span>
                                <span slot="close">关</span>
                            </i-switch>

                        </Form-item>
                    </div>
                    <div class="col-md-12">
                    <span class="form-note">请登录 <a target="_blank"
                                                   href="https://ziyuan.baidu.com/mip/index">百度搜索资源平台</a>
                            &gt;&gt;&gt; 网站支持 &gt;&gt;&gt; MIP & AMP &gt;&gt;&gt; 数据提交， 复制<b>推送接口</b>下完整的接口调用地址。
                        </span>
                        <br> <b>注意：如果选择站点中没有您当前的网站域名，请在
                        用户中心 &gt;&gt;&gt; <a target="_blank" href="https://ziyuan.baidu.com/site/index">站点管理</a>
                        下添加当前的网站域名</b>
                        <br>
                        <span class="form note">打开：则保存新闻的时候，自动推送到 百度搜索资源平台 &gt;&gt;&gt; MIP & AMP</span>

                    </div>
                </div>

            </i-form>
        </section>
    </section>

    <section class="mip-box">
        <section class="mip-box-heading">
            <h3>熊掌号</h3>
        </section>
        <section class="mip-box-body">
            <i-form label-position="top">
                <div class="row">
                    <div class="col-md-6">
                        <div class="row">
                            <div class="col-md-6">
                                <Form-item label="熊掌号模式【guanfanghaoStatus】">
                                    <i-switch v-model="setting.guanfanghaoStatus">
                                        <span slot="open">开</span>
                                        <span slot="close">关</span>
                                    </i-switch>
                                </Form-item>
                            </div>
                            <div class="col-md-6">
                                <Form-item label="熊掌号自动推送【guanfanghaoStatusPost】">
                                    <i-switch v-model="setting.guanfanghaoStatusPost">
                                        <span slot="open">开</span>
                                        <span slot="close">关</span>
                                    </i-switch>
                                </Form-item>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <Form-item label="熊掌号ID【guanfanghaoID】">
                                <i-input v-model="setting.guanfanghaoID"></i-input>
                            </Form-item>
                        </div>
                        <div class="col-md-12">
                            <Form-item label="熊掌号天级收录接口【guanfanghaoRealtimeUrl】">
                                <i-input v-model="setting.guanfanghaoRealtimeUrl" placeholder="例：http://data.zz.baidu.com/urls?appid=1590894693830359&token=cgsf71bHsSKm5cVb&type=realtime"></i-input>
                            </Form-item>
                        </div>
                        <div class="col-md-12">
                            <Form-item label="熊掌号周级收录接口【guanfanghaoUrl】">
                                <i-input v-model="setting.guanfanghaoUrl" placeholder="例：http://data.zz.baidu.com/urls?appid=1590894693830359&token=cgsf71bHsSKm5cVb&type=batch"></i-input>
                            </Form-item>
                        </div>


                    </div>
                    <div class="col-md-6">
                    <span class="form-note">
                        熊掌号类似百度的公众号，将百度索资源平台、数据开放平台、百家号自媒体平台、用户运营平台等各类平台的能力互通，
                        <a target="_blank" href="https://xiongzhang.baidu.com/">开通熊掌号</a>并与您的网站内容关联，将进一步保证百度抓取和收录您网站的内容。<br>
                        <b>开启熊掌号模式：</b>当您的网页内容被百度收录后，网页上将显示百度的关注按钮。<br>
                        <b>开启熊掌号自动推送：</b>文章保存的时候，自动推送到熊掌号<br><br>

                        <b>熊掌号内容提交：</b>熊掌号的内容提交包括天级收录和周级收录。首先：将您当前的网站域名加入到
                        <a target="_blank" href="https://ziyuan.baidu.com/xzh/config/index">搜索资源平台 - 熊掌号的内容源设置</a>中，
                        一个熊掌号只能绑定一个顶级域名。<br><br>
                        <b>熊掌号天级收录接口：</b> 登录进入 <a target="_blank" href="https://ziyuan.baidu.com/xzh/home/index">搜索资源平台 - 熊掌号</a>
                        选择资源提交 &gt;&gt;&gt; 天级收录  >>> 内容提交 >>> API提交 ，完整复制接口调用地址即可。<br>
                        例如：http://data.zz.baidu.com/urls?appid=1590894693830359&token=cgsf71bHsSKm5cVb&type=realtime<br>
                        这里的appid是您的熊掌号ID
                        <br><br>
                        <b>熊掌号周级收录接口：</b> 登录进入 <a target="_blank" href="https://ziyuan.baidu.com/xzh/home/index">搜索资源平台 - 熊掌号</a>
                        选择资源提交 &gt;&gt;&gt; 周级收录 >>> 内容提交 ，完整复制接口调用地址即可。<br>
                         例如：http://data.zz.baidu.com/urls?appid=1590894693830359&token=cgsf71bHsSKm5cVb&type=batch<br>
                        这里的appid是您的熊掌号ID
                        <br><br>

                    </span>
                    </div>
                </div>



            </i-form>
        </section>
    </section>

    <section class="mip-box">
        <section class="mip-box-heading">
            <h3>原创推送</h3>
        </section>
        <section class="mip-box-body">
            <i-form label-position="top">
                <div class="row">
                    <div class="col-md-6">
                        <Form-item label="原创提交接口【baiduYuanChuangUrl】">
                            <i-input v-model="setting.baiduYuanChuangUrl"></i-input>
                        </Form-item>
                    </div>
                    <div class="col-md-2">
                        <Form-item label="原创自动推送【baiduYuanChuangStatus】">
                            <i-switch v-model="setting.baiduYuanChuangStatus">
                                <span slot="open">开</span>
                                <span slot="close">关</span>
                            </i-switch>
                        </Form-item>
                    </div>
                </div>
            </i-form>
        </section>
    </section>


    <section class="mip-box">
        <section class="mip-box-heading">
            <h3>链接推送</h3>
        </section>
        <section class="mip-box-body">
            <i-form label-position="top">
                <div class="row">
                    <div class="col-md-6">
                        <Form-item label="链接提交接口【baiduTimePcUrl】">
                            <i-input v-model="setting.baiduTimePcUrl"></i-input>
                        </Form-item>
                    </div>
                    <div class="col-md-2">
                        <Form-item label="链接自动推送【baiduTimePcStatus】">
                            <i-switch v-model="setting.baiduTimePcStatus">
                                <span slot="open">开</span>
                                <span slot="close">关</span>
                            </i-switch>
                        </Form-item>
                    </div>
                </div>
            </i-form>
        </section>
    </section>


    <section class="mip-box">
        <section class="mip-box-heading">
            <h3>百度站内搜索</h3>
        </section>
        <section class="mip-box-body">
            <i-form label-position="top">
                <div class="row">
                    <div class="col-md-6">
                        <Form-item label="百度站内搜索Key【biaduZn】">
                            <i-input v-model="setting.biaduZn"></i-input>
                        </Form-item>
                        <Form-item label="百度站内搜索sitemap【baiduSearchPcUrl】">
                            <i-input v-model="setting.baiduSearchPcUrl"></i-input>
                        </Form-item>
                    </div>
                    <div class="col-md-6">
                    </div>
                </div>
            </i-form>
        </section>
    </section>
</main>
{/block}

{block name="javascript"}
{__block__}
<script>
    new Vue({
        el: '#app',
        data: {
            setting: '',
        },
        watch: {},
        mounted() {
            this.getSettingData();
        },
        methods: {
            onSubmitSetting: function () {
                var _this = this;
                if (this.setting.guanfanghaoID != '') {
                    this.setting.guanfanghaoCambrian = '<mip-cambrian site-id="' + this.setting.guanfanghaoID + '"></mip-cambrian>';
                }
                this.$mip.ajax('{$mipInfo.domain}/setting/ApiAdminSetting/settingEdit', {
                    setting: JSON.stringify(this.setting),
                }).then(function (res) {
                    if (res.code == 1) {
                        _this.$Message.success('保存成功');
                        _this.getSettingData();
                    }
                });
            },
            getSettingData: function () {
                var _this = this;
                this.loading = true;
                this.$mip.ajax('{$mipInfo.domain}/setting/ApiAdminSetting/settingSelect', {}).then(function (res) {
                    _this.loading = false;
                    if (res.code == 1) {
                        var temp = res.data;
                        if (temp.systemStatus) {
                            temp.systemStatus = true;
                        } else {
                            temp.systemStatus = false;
                        }
                        if (temp.loginStatus) {
                            temp.loginStatus = true;
                        } else {
                            temp.loginStatus = false;
                        }
                        if (temp.registerStatus) {
                            temp.registerStatus = true;
                        } else {
                            temp.registerStatus = false;
                        }
                        if (temp.idStatus) {
                            temp.idStatus = true;
                        } else {
                            temp.idStatus = false;
                        }
                        if (temp.codeCompression) {
                            temp.codeCompression = true;
                        } else {
                            temp.codeCompression = false;
                        }
                        if (temp.baiduSpider) {
                            temp.baiduSpider = true;
                        } else {
                            temp.baiduSpider = false;
                        }
                        if (temp.articlePages) {
                            temp.articlePages = true;
                        } else {
                            temp.articlePages = false;
                        }
                        if (temp.mipPostStatus) {
                            temp.mipPostStatus = true;
                        } else {
                            temp.mipPostStatus = false;
                        }
                        if (temp.baiduYuanChuangStatus) {
                            temp.baiduYuanChuangStatus = true;
                        } else {
                            temp.baiduYuanChuangStatus = false;
                        }
                        if (temp.guanfanghaoStatus) {
                            temp.guanfanghaoStatus = true;
                        } else {
                            temp.guanfanghaoStatus = false;
                        }
                        if (temp.guanfanghaoStatusPost) {
                            temp.guanfanghaoStatusPost = true;
                        } else {
                            temp.guanfanghaoStatusPost = false;
                        }

                        if (temp.baiduTimePcStatus) {
                            temp.baiduTimePcStatus = true;
                        } else {
                            temp.baiduTimePcStatus = false;
                        }
                        if (temp.baiduTimeMStatus) {
                            temp.baiduTimeMStatus = true;
                        } else {
                            temp.baiduTimeMStatus = false;
                        }
                        if (temp.diyUrlStatus) {
                            temp.diyUrlStatus = true;
                        } else {
                            temp.diyUrlStatus = false;
                        }
                        if (temp.urlCategory) {
                            temp.urlCategory = true;
                        } else {
                            temp.urlCategory = false;
                        }

                        if (temp.aritcleLevelRemove) {
                            temp.aritcleLevelRemove = true;
                        } else {
                            temp.aritcleLevelRemove = false;
                        }

                        if (temp.superSites) {
                            temp.superSites = true;
                        } else {
                            temp.superSites = false;
                        }

                        if (temp.rewrite) {
                            temp.rewrite = true;
                        } else {
                            temp.rewrite = false;
                        }
                        temp.baiduSearchPcUrl = '{$mipInfo.domain}' + '/baiduSitemapPc.xml';
                        temp.baiduSearchMUrl = '{$mipInfo.domain}' + '/baiduSitemapMobile.xml';
                        _this.setting = temp;
                    }
                });
            },

        }
    })
</script>
{/block}